using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.Serialization;
namespace Net35.Xrm.Sdk.Client
{
	[Serializable]
	public sealed class IssuerEndpointDictionary : Dictionary<string, IssuerEndpoint>
	{
		public IssuerEndpointDictionary()
		{
		}
		private IssuerEndpointDictionary(SerializationInfo info, StreamingContext context) : base(info, context)
		{
		}
		public IssuerEndpoint GetIssuerEndpoint(TokenServiceCredentialType credentialType)
		{
			if (credentialType == TokenServiceCredentialType.None)
			{
				return null;
			}
			foreach (KeyValuePair<string, IssuerEndpoint> current in this)
			{
				if (current.Value.CredentialType == credentialType)
				{
					return current.Value;
				}
			}
			throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "The authentication endpoint {0} was not found on the configured Secure Token Service!", new object[]
			{
				credentialType
			}));
		}
	}
}
